<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/context/mytags.jsp" %>
<!DOCTYPE html>
<head>
    <title></title>
    <t:base type="jquery,easyui,tools,DatePicker"></t:base>
</head>
<body>
    <input type="hidden" value="${serviceId}" name="serviceId" id="serviceId">
    <table class="nobordertable noborder" style="border: none;">
        <tbody>
        <tr>
            <td class="al_r" width="15%">
                <label>电话:</label>
            </td>
            <td width="70%">
                <input class="inputxt" id="phone" name="phone" value="${phone}"/>
            </td>
        </tr>
        <tr>
            <td class="al_r" width="15%" valign="top">
                <label>短信模板:</label>
            </td>
            <td width="70%">
                <textarea style="width: 300px; height: 174px; margin: 0px;" disabled="disabled" name="htmlText" id="htmlText">${htmlText}</textarea>
            </td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center;">
                <a href="#" class="easyui-linkbutton l-btn" id="submitBtn3">确认发送</a>
                <a href="#" class="easyui-linkbutton l-btn" id="cancelPlan2" onclick="cancelPlanButton()">取消</a>
            </td>
        </tr>
        </tbody>
    </table>
</body>
<script>
    $("#submitBtn3").click(function () {
        save();
    });
    function save() {
        var phone = $("#phone").val();
        var html=$("#htmlText").val();
        if(""==phone){
            tip("手机不能为空");
            return;
        }
        if(""==html){
            tip("短信内容不能为空");


        }else{
            $.ajax({
                url: "cbsServiceController.do?saveServiceAndMessage",
                data: {
                    "serviceId": $("#serviceId").val(),
                    "phone":phone,
                    "htmlText":html
                },
                cache: false,
                dataType: 'json',
                type: 'POST',
                success: function (data) {
                    top.tip(data.msg);
                    addOneTab("服务单管理", "cbsServiceController.do?cbsService");
                    closetab('新建服务单');
                }
            });
        }
    }

    function cancelPlanButton() {
        addOneTab("服务单管理", "cbsServiceController.do?cbsService");
        closetab('新建服务单');
        frameElement.api.close();
    }
</script>
</html>
